﻿@{
    ViewBag.Title = "XiYiDaoRuIndex";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Head
{
    @Html.Css("dp")
    <script type="text/javascript" language="javascript">
        // 匯入確定按鈕
        function checkFile() {
            $("#h_filePath").val($("#importFile").val());

            $("form").attr("action", "Import");
        }
        function checkFile1() {
            $.ajax({
                type: "POST",
                url: '@Url.Action("FileUp1")',
                data: {},
                dataType: "json",
                async: false,
                success: function (data) {
                    if (data == "1") {
                        alert("导入成功!");
                    }
                    else {
                        alert("缺少卡号:" + data + "-导入失败!");
                    }
                },
                error: function () { }
            });
        }
    </script>
}
@using (Html.BeginForm("FileUp", "MenuConfiguration", FormMethod.Post, new { enctype = "multipart/form-data", id = "UploadCheOrderPeo" }))
{
    <div id="container">
        <div id="mainContent">
            <div id="title" class="title">
                洗衣券导入</div>
            <div id="findDiv">
                <table>
                    <tr>
                        <td>
                            <input type="file" name="importFile" id="importFile" />
                            @Html.Hidden("h_filePath")
                            <button type="submit" value="上传" id="btnConfirm" onclick="return checkFile();" style="width: 70px;
                                height: 20px">
                                上传
                            </button>
                            <button type="submit" value="导入" id="btnConfirm1" onclick="return checkFile1();"
                                style="width: 70px; height: 20px">
                                导入
                            </button>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
}
